package PhotovoltaicPowerStation.Equipments;

import java.io.Serializable;

/**
 * @Description:光伏发电站系统中的设备基类,用于被子类对象继承
 * @Author:AMark
 * @Date: 11/1/2023
 */
public class Equipment implements Serializable {
    //设备编号以及状态
    protected String ID,Name;
    //用于生成编号的静态变量
    protected static int count;
    //设备状态
    protected status Status;
    public Equipment(){
        count++;
    }
    public String getID() {
        return this.ID;
    }
    public String getName(){
        return this.Name;
    }
    //设备初始化，第一个是名称，第二个是状态
    public Equipment(String name,int status) {
        this.Name = name;
        if (status == 1) {
            this.Status = PhotovoltaicPowerStation.Equipments.status.Normal;
        } else if (status == 2) {
            this.Status = PhotovoltaicPowerStation.Equipments.status.Broken;
        } else if (status == 3) {
            this.Status = PhotovoltaicPowerStation.Equipments.status.Stop;
        } else {
            System.out.println("输入有误，请重新输入！");
        }
        //实现自动编号
        this.ID = String.format("E%04d",count++);
    }
}
